import request from '@/utils/request'

// 获取用户帖子列表
export function listUserPost(query) {
  return request({
    url: '/user/forum/list',
    method: 'get',
    params: query
  })
}

// 获取帖子详情
export function getPost(postId) {
  return request({
    url: `/user/forum/${postId}`,
    method: 'get'
  })
}

// 更新帖子
export function updatePost(data) {
  return request({
    url: '/user/forum',
    method: 'put',
    data: data
  })
}

// 删除帖子
export function deletePost(postId) {
  return request({
    url: `/user/forum/${postId}`,
    method: 'delete'
  })
}

// 发布帖子
export function addPost(data) {
  return request({
    url: '/user/forum',
    method: 'post',
    data: data
  })
}

// 获取帖子评论列表
export function listComment(query) {
  return request({
    url: '/user/forum/comment/list',
    method: 'get',
    params: query
  })
}

// 发表评论
export function addComment(data) {
  return request({
    url: '/user/forum/comment',
    method: 'post',
    data: data
  })
}

// 删除评论
export function deleteComment(commentId) {
  return request({
    url: `/user/forum/comment/${commentId}`,
    method: 'delete'
  })
} 